{extend name="layout" /}
{block name="content"}
<div class="mui-content">
	<form id="formid" method="post">
	<div class="tm-df-size">
		<div class="tm-label tm-font-gray">
			<div class="main-content">
				<span>底层图片</span>
			</div>
		</div>
		<ul class="mui-table-view max no">
			<li class="mui-table-view-cell">
				<div class="tm-cell-pad">
					<div class="tm-flex flex-align-center">
						<div class="tm-icon-item">
							<img src="{$info.thumb}" alt="" width="50%" />
							<input type="hidden" name="thumb" value="{$info.thumb}">
						</div>
					</div>
				</div>
			</li>
		</ul>
	</div>
	<div class="tm-df-size">
		<div class="tm-label tm-font-gray">
			<div class="main-content">
				<span>添加图片信息</span>
			</div>
		</div>
		<ul class="mui-table-view max">
			<li class="mui-table-view-cell">
				<div class="tm-cell-pad">
					<div class="tm-flex flex-align-center">
						<div class="tm-flex-1">
							<span class="tm-font-bold">选择模板</span>
						</div>
						<div class="tm-icon-item">
							<select name="formworkid" style="height: 30px;padding: 2px;margin-right: 25px;padding-left: 100px;">
								<option value="">请选择</option>
								<option value="1" {eq name="info.formworkid" value="1"} selected {/eq}>模板1</option>
								<option value="2" {eq name="info.formworkid" value="2"} selected {/eq}>模板2</option>
								<option value="3" {eq name="info.formworkid" value="3"} selected {/eq}>模板3</option>
							</select>
						</div>
					</div>
				</div>
			</li>
			<li class="mui-table-view-cell">
				<div class="tm-cell-pad">
					<div class="tm-flex flex-align-center">
						<div class="tm-flex-1">
							<span class="tm-font-bold">选择标题</span>
						</div>
						<div class="tm-icon-item">
							<select name="select_title" style="height: 30px;padding: 2px;margin-right: 25px;padding-left: 100px;">
								<option value="">请选择</option>
								{volist name="info.titles" id="v"}
								<option value="{$v}" {eq name="info.title" value="3"} selected {/eq}>{$v}</option>
								{/volist}
							</select>
						</div>
					</div>
				</div>
			</li>
			<li class="mui-table-view-cell">
				<div class="tm-cell-pad">
					<div class="tm-flex flex-align-center">
						<div class="tm-flex-1">
							<span class="tm-font-bold">分享标题</span>
						</div>
						<div class="tm-icon-item">
							<div class="tm-icon-label">
								<input class="tm-font-gray" type="text" name="write_title" value="{$info.title}" placeholder="自己添写标题，则选择的标题无效" style="width: 200px;height: 30px;border: none;text-align: right;">
							</div>
						</div>
					</div>
				</div>
			</li>
		</ul>
	</div>
	<input type="hidden" name="id" value="{$info.id}">
	</form>
</div>
{/block}
{block name="script"}
<script type="text/javascript">
	function suc_back (obj, data) {
		$("#thumb").attr('src', data.thumb);
		$("#creat_thumb").val(data.thumb);
	}
</script>
<script type="text/javascript">
    $(function(){
        c3_navtive_user.right_button_item1 = {
            title:"保存",
            callback:function(){
                coco_confirm('确定要保存吗？',function() {
            		var datajson = $("#formid").serialize();
					$.ajax({
				    	url: "{:url('v1/adminuser/update_poster')}",
				    	type:'post',
				    	dataType: 'json',
				    	data: datajson,
				    	beforeSend: function(request) {
				    		request.setRequestHeader("token", token);
				    		request.setRequestHeader("timestamp", timestamp);
				    	},
				    	error: function (XMLHttpRequest, textStatus, errorThrown) {
				    		coco_close_loading();
				    		var codetext = XMLHttpRequest.responseText;
				    		codejson = eval("(" + codetext + ")");
				    		coco_alert(codejson.msg);
				    		return false;
				    	},
				    	success:function(datajson){
				    		coco_msg('保存成功');
				    		setTimeout(function() {
				    			coco_close_window();
				    		}, 500);
				    	}
				    })
            	})
            }
        };
        var button_item = [
            {
                title: "保存",
                returnTag:'1'
            }
        ];
        {if !isset($isphone)}
            c3_navtive_user.doActionFunc("configMenu",button_item,function(datas){
                returntag = eval('(' + datas + ')');
                if(returntag.returnTag == 1){
                	coco_confirm('确定要保存吗？',function() {
                		var datajson = $("#formid").serialize();
						$.ajax({
					    	url: "{:url('v1/adminuser/update_poster')}",
					    	type:'post',
					    	dataType: 'json',
					    	data: datajson,
					    	beforeSend: function(request) {
					    		request.setRequestHeader("token", token);
					    		request.setRequestHeader("timestamp", timestamp);
					    	},
					    	error: function (XMLHttpRequest, textStatus, errorThrown) {
					    		coco_close_loading();
					    		var codetext = XMLHttpRequest.responseText;
					    		codejson = eval("(" + codetext + ")");
					    		coco_alert(codejson.msg);
					    		return false;
					    	},
					    	success:function(datajson){
					    		coco_msg('保存成功');
					    		setTimeout(function() {
					    			coco_close_window();
					    		}, 500);
					    	}
					    })
                	})
                }
                else if(returntag.returnTag == 2){
                    c3_navtive_user.doActionAnsy('openSearch',null,function(){});
                }
            });
        {/if}
    })
</script>
{/block}